package com.springinaction.springidol;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {
	
	public static void main(String[] args) {

		ApplicationContext ctx = new ClassPathXmlApplicationContext("com/springinaction/springidol/spring-idol.xml");
		
		Performer performer = (Performer) ctx.getBean("duke");
		Performer kenny = (Performer) ctx.getBean("kenny");
		Performer hank = (Performer) ctx.getBean("hank");
		Performer bob = (Performer) ctx.getBean("bob");
		Stage stage = (Stage) ctx.getBean("stage");
		
		try {
				
			kenny.perform();
			
			kenny = null;
			
			performer.perform();
			
			hank.perform();
			
			bob.perform();
			
			System.gc();
			
		} catch (PerformanceException e) {
			e.printStackTrace();
		}
	}
}
